<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>作用域插槽</title>
</head>

<body>
  <div id="app">
    <h1>vue的例子</h1>
    <p>{{msg}}</p>
    <hr>
    <demo>
      <template v-slot="aaa">{{aaa}}</template>
    </demo>
    <demo>
      <template v-slot="obj">{{obj.money}}=={{obj.brand}}</template>
    </demo>
    <demo>
      <template v-slot:user="obj">{{obj}}</template>
    </demo>
  </div>
  <script src="./vue.js"></script>
  <script>
    Vue.config.productionTip = false; // 关闭生产提示
    Vue.component('demo', {
      template: `<div>
        <slot money=200 brand="宝马"></slot>
        <slot name="user" :user="user"></slot>
        </div>`,
        data(){
          return {
            user:{
              name:'jack',
              age:20,
              score:100
            }
          }
        }
    })
    const vm = new Vue({
      el: '#app',
      data: {
        msg: 'hello'
      }
    })
  </script>
</body>

</html>